Skip to content

Don't allocate for zero- or one-stream batches in Task::batch - #3414

Open
edwloef wants to merge 1 commit into
iced-rs:masterfrom
edwloef:task-batch-empty
Open

Don't allocate for zero- or one-stream batches in Task::batch#3414
edwloef wants to merge 1 commit into
iced-rs:masterfrom
edwloef:task-batch-empty

Conversation

@edwloef

@edwloef edwloef commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

A rather trivial optimization that saves on allocating when batching an iterator of zero or one non-none tasks.

I heavily abuse Task::batch to compose messages, and it not adding unnecessary heap allocations and dyn-indirection would make me feel a lot less bad about it 😆

@edwloef edwloef changed the title Don't allocate empty streams in Task::batch Don't allocate for zero- or one-stream batches in Task::batch Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant